<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="./2.css">
    <title>层叠上下文</title>
    <style>
        .box{
            height: 100px;
            width: 100px;
            position: absolute;

        }
        .box1{
           
            top: 2px;
            left: 2px;            
            background-color: red;
            z-index: 1;
        }
        .box2{
            
            top: 20px;
            left: 20px;
            background-color: blue;
            z-index: 2;
        }
    </style>
</head>
<body>
   <div class="box box1">box1</div> 
   <div class="box box2">box2</div> 
</body>
</html>